<HTML>
<HEAD>
<TITLE>
PointerType.cpp
</TITLE>
</HEAD>
<BODY>
<PRE>
<font color="green">/*
* Copyright 2006 the original author or authors.
* 
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* 
*      http://www.apache.org/licenses/LICENSE-2.0
* 
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/</font>

<font color="blue">#include</font> <font color="maroon">"PointerType.h"</font>
<font color="blue">#include</font> <font color="maroon">"TypeManager.h"</font>

<font color="blue">namespace</font> Autumn<font color="black">{</font>

<font color="blue">void</font><font color="black">*</font> PointerType<font color="black">:</font><font color="black">:</font>createValue<font color="black">(</font><font color="blue">const</font> string<font color="black">&</font> type, <font color="blue">const</font> StrValueList<font color="black">&</font> vl,
                               StrIterator<font color="black">&</font> it<font color="black">)</font><font color="blue">const</font>
<font color="black">{</font>
    string basicType <font color="black">=</font> type.substr<font color="black">(</font><font color="maroon">0</font>, type.size<font color="black">(</font><font color="black">)</font><font color="maroon">-1</font><font color="black">)</font>; <font color="green">// erase the '*'</font>
    IAutumnType<font color="black">*</font> at <font color="black">=</font> <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>getTypeManager<font color="black">(</font><font color="black">)</font><font color="black">-</font><font color="black">&#62;</font>findTypeBean<font color="black">(</font>basicType<font color="black">)</font>;

    <font color="blue">void</font><font color="black">*</font> p <font color="black">=</font> at<font color="black">-</font><font color="black">&#62;</font>createValue<font color="black">(</font>basicType, vl, it<font color="black">)</font>;

    <font color="blue">void</font><font color="black">*</font><font color="black">*</font> pp <font color="black">=</font> <font color="blue">new</font> <font color="black">(</font><font color="blue">void</font><font color="black">*</font><font color="black">)</font>;
    <font color="black">*</font>pp <font color="black">=</font> p;
    <font color="blue">return</font> <font color="black">(</font><font color="blue">void</font><font color="black">*</font><font color="black">)</font>pp;
<font color="black">}</font>

<font color="blue">void</font> PointerType<font color="black">:</font><font color="black">:</font>freeValue<font color="black">(</font><font color="blue">void</font><font color="black">*</font> p, <font color="blue">const</font> string<font color="black">&</font> type<font color="black">)</font>
<font color="black">{</font>
    string basicType <font color="black">=</font> type.substr<font color="black">(</font><font color="maroon">0</font>, type.size<font color="black">(</font><font color="black">)</font><font color="maroon">-1</font><font color="black">)</font>; <font color="green">// erase the '*'</font>
    IAutumnType<font color="black">*</font> at <font color="black">=</font> <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>getTypeManager<font color="black">(</font><font color="black">)</font><font color="black">-</font><font color="black">&#62;</font>findTypeBean<font color="black">(</font>basicType<font color="black">)</font>;
    
    at<font color="black">-</font><font color="black">&#62;</font>freeValue<font color="black">(</font><font color="black">*</font><font color="black">(</font><font color="blue">void</font><font color="black">*</font><font color="black">*</font><font color="black">)</font>p, basicType<font color="black">)</font>;
    <font color="blue">delete</font> <font color="black">(</font><font color="blue">void</font><font color="black">*</font><font color="black">*</font><font color="black">)</font>p;
<font color="black">}</font>

<font color="black">}</font> <font color="green">// End namespace Autumn</font>

</PRE>
</BODY>
</HTML>
